package com.srcbox.file.adapter

import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.PagerAdapter

class MainPager(fm: FragmentManager, private val viewList: List<Fragment>) :
    FragmentPagerAdapter(fm) {
    override fun getItem(position: Int): Fragment {
        return viewList[position]
    }

    override fun getCount(): Int {
        return viewList.size
    }

    override fun setPrimaryItem(container: ViewGroup, position: Int, `object`: Any) {
        super.setPrimaryItem(container, position, `object`)
    }

    /*override fun isViewFromObject(view: View, `object`: Any): Boolean {
            return view == `object`
    }

    override fun getCount(): Int {
        return viewList.size
    }

    override fun instantiateItem(container: ViewGroup, position: Int): Any {
        val pageView = viewList[position]
        container.addView(pageView)
        return pageView
    }

    override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
//       super.destroyItem(container, position, `object`)
        container.removeView(viewList[position])
    }*/
}